package com.endava.spring.dao_interface;

import javax.sql.DataSource;

import org.springframework.jdbc.core.JdbcTemplate;

/**
 * Sets the <code>DataSource</code> for the objects who use it.
 * 
 * @author acojocar
 * 
 */
public abstract class DataSourceDao {

	private DataSource dataSource;
	protected JdbcTemplate jdbcTemplate;

	/**
	 * Sets the <code>DataSource</code> used for Spring JDBC.
	 * 
	 * @param dataSourcethe
	 *            <code>DataSource</code> to set
	 */
	public void setDataSource(DataSource dataSource) {
		this.dataSource = dataSource;
		this.jdbcTemplate = new JdbcTemplate(dataSource);
	}

	/**
	 * Gets the Data Source.
	 * 
	 * @return data source
	 */
	public DataSource getDataSource() {
		return dataSource;
	}

}
